If something is in the bag, it's a sure success. If you studied hard for a test and then found all the questions super easy, you might tell your friends afterwards that passing is in the bag.
When you say something is in the bag, you're saying that it's not true yet, but you're really certain it will be. It's usually used to express positive things, like getting a job you want or winning a competition. Think of it like this: if you have a check for $100 in your bag, that money isn't in your bank account yet...but unless something drastic happens, it certainly will be soon.